<template>
    <!--用来接收点击事件后隐藏弹出菜单的层-->
    <div class="contentDiv" ref="contentDiv">
        <!--loading动画-->
        <div class="loadingDiv" style="display:none" ref="loadingDiv">
            <p>加载中</p>
        </div>
        <!--答题标题 start-->
        <div id="ContentTop">
            <div class="topleft doexamtit" ref="chaptername" @click="backUrl"></div>
            <!-- 收藏 -->
            <div class="topright2" @click="favClick" id="addFav" style="right:50px; display: none">
                <img src="../../images/wsc.png" style="margin-top:-5px;width:20px;height:20px;" />
            </div>
            <div class="topright2" @click="removefavClick" id="removeFav" style="right:50px;display: none">
                <img src="../../images/ysc.png" style="margin-top:-5px;width:20px;height:20px;" />
            </div>
            <!-- 批阅 -->
            <div class="topright2" id="marking2" @click="markingPY" style="display: none;right:10px;">
                <img src="../../images/piyue_gai.png" id="markingImg2" style="margin-top:-5px;width:20px;height:20px;" />
            </div>
            <!-- 删除 -->
            <div class="topright2" id="delete" @click="deleteCus" style="display:none;cursor:pointer;">
                <img src="../../images/shanchu.png" style="margin-top:-6px;width:21px;height:21px;" />
            </div>
        </div>
        <!--答题标题 end-->
        <!--开始 页面的id不要轻易改动==========================================================================================================================================-->
        <div id="exambt" style="display: none">
            <div id="exam">
                <!-- 组件 -->
                <radioExam></radioExam>
                <!-- 单选题 end -->
                <checkBoxExam></checkBoxExam>
                <!-- 多选题 end -->
                <threeRadioExam></threeRadioExam>
                <!-- A3TEST 单选题 end -->
                <threeCheckBoxExam></threeCheckBoxExam>
                <!-- A3TEST 多选题 end -->
                <bRadioExam></bRadioExam>
                <!-- BTEST 单选题 end -->
                <bCheckBoxExam></bCheckBoxExam>
                <!-- BTEST 多选题 end -->
                <pdExam></pdExam>
                <!-- 判断题 end -->
                <jdExam></jdExam>
                <!-- 简答题 end -->
                <tkExam></tkExam>
                <!-- 填空题 end -->
            </div>
            <!--exambt end-->
        </div>
        <!--结束==========================================================================================================================================-->
        <!--滑动层-->
        <div ref="dragContent" class="outer">
            <div id="innerdiv" class="inner">
            </div>
        </div>
        <!--滑动层-->
        <!--底部展现的输入框-->
        <div id="add_dialog" class="bottom-nav1" style="display:none;position: fixed;bottom: 0px;z-index: 31;">
            <input type="text" id="discuss_text" placeholder="请输入">
            <div id="discuss_cancel" class="add-discuss">取消</div>
            <div id="discuss_add" class="add-discuss">保存</div>
        </div>
        <!-- 弹框 -->
        <div class="customBox" id="customBox">
            <div class="customBoxDrop" id="customDrop"></div>
            <div class="customContent">
                <h2></h2>
                <p>确定掌握了再删掉我哦！</p>
                <span>
                    <a href="javascript:;" id="customSure">确认</a>
                    <a href="javascript:;" id="customCancel">取消</a>
                </span>
                <div class="closed" id="customBtnClosed">
                    <img src="../../images/guanbi.png" alt="关闭弹框" />
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { getStore, setStore, removeStore } from "../../config/mUtils";
// import _gAllTest from "./data/testData";
import Flipsnap from "./data/flipsnap";
import { setID } from "./data/setIDArr";

import G_Prg from './data/yingSoftPrg';
import G_Cookie from './data/yingSoftCookie';
import G_SetTestInfo from './data/yingSoftSetTest';

import radioExam from "./children/radioExam";
import checkBoxExam from "./children/checkBoxExam";
import threeRadioExam from "./children/threeRadioExam";
import threeCheckBoxExam from "./children/threeCheckBoxExam";
import bRadioExam from "./children/bRadioExam";
import bCheckBoxExam from "./children/bCheckBoxExam";
import pdExam from "./children/pdExam";
import jdExam from "./children/jdExam";
import tkExam from "./children/tkExam";

//import andImgSrc from "../../images/16000004.jpg";

export default {
    components: {
        radioExam, // 单选题
        checkBoxExam, // 多选题
        threeRadioExam, // A3TEST 单选题
        threeCheckBoxExam, // A3TEST 多选题
        bRadioExam, // BTEST 单选题
        bCheckBoxExam, // BTEST 多选题
        pdExam, // 判断题
        jdExam, // 简答题
        tkExam // 填空题
    },
    data: function() {
        return {
            // _gAllTest: null
            _allTest: null, //
            _gFlipsnap: {}, // 滑动控件
            isShowTopic: true, //是否显示题目
            isShowItems: true, //是否显示选项
            isShowExplain: true, //是否显示解析
            isShowNote: true, //是否显示笔记内容
            isShowUserAnswer: true, //是否显示用户答题信息
            isShowRightAnswer: true, //是否显示正确答案
            isDisabled: true, //是否可以作答
            isShowRightAndWrong: true, //显示用户所选答案是否正确
            isShowOtherNote: true, //是否显示其他人的笔记
            selected: 0, // 从模拟考场进入答题界面，用户选择答案后，标记该值为1，提交批阅后，修改状态为0；用于控制上下一题时选项的选中状态
            _gAddFlag: '',

            replyStartTime: new Date(), //答题开始时间
            viewCount: 0, //简答题、填空题已做过/浏览的试题数量
            fromUrl: 'simulatedExam.html', // 来源url
            htmlTemplate: '', //保存的html模板
            doTest: false, //标记点击了答题按钮进行操作 
            blurFlag: '', //标记简答题、填空题在失去焦点时，控制不显示笔记
            appEName: null, //科目英文名
            gAddFlag: '', //标记是哪个点击了添加按钮
            photoID: null, //照片编码
            title: '', //界面上展示的标题
            firstShow: [], //用来标记试题是否第一次显示的数组的
            addNote: [], // 添加笔记
            regerN: new RegExp('\n', 'gm'),

            dragIndexByTestIndex: null, // 应该显示的索引

            arrTypeExplain: null,
            G_customD: null, // 自定义弹框

            isFavClicked: false, // 是否已经收藏
            beginStartTime:new Date()
        }
    },
    methods: {
        // body
        onload: async function() {
            let _that = this;
            // 加载
            if (!!document.all) {
                window.attachEvent('onresize', this.winResize);
            } else {
                window.addEventListener('resize', this.winResize, false);
            }
        },
        winResize: function() {
            // 窗口改变
            this.$refs.contentDiv.style.height = window.document.body.clientHeight + 'px';
            this.$refs.dragContent.style.height = window.document.body.clientHeight + 'px';
        },
        testUI: async function() {
            // 总函数
            let _that = this;
            // 获取数据
            let proms = await Promise.all([
                import ('./data/testData')
            ]).then((resolve, reject) => {
                _that._allTest = resolve[0].default;
            });
            // 刷新数据
            _that._allTest.refreshgo();

            // 开始
            _that.arrTypeExplain = _that._allTest.setExplain();
            _that.photoID = this.$route.query.photoID;
            if (_that.$route.query.allTestID) {
                let curTestNO = _that._allTest.getTestNO(parseInt(_that.$route.query.allTestID));
                _that._allTest.move(parseInt(curTestNO) - 1); //设置当前试题编号
            } else {
                _that._allTest.move(0); //设置当前试题编号
//              _that._allTest.move(34); //设置当前试题编号
            }
            if (_that.photoID) { //根据传递的相片ID，定位对应试题
                _that.title = '线下传题';
                let curTestNO = _that._allTest.getTestNO(parseInt(_that.photoID));
                _that._allTest.move(parseInt(curTestNO) - 1); //设置当前试题编号
            }

            if (_that.fromUrl === '') {
                _that.setState('mock');
            } else {
                _that.setState('uncommited');
            }

            _that.G_customD = new _that.showCustomBox();

            _that.dragIndexByTestIndex = _that.getDragIndexByTestIndex(); //计算应该显示的索引，如果从错题、笔记、收藏进来会跳到试题对应的滑动层
            _that.init();
            _that.initFlipsnap(_that._gFlipsnap);
            if (_that._gFlipsnap.currentPoint !== _that.dragIndexByTestIndex) {
                _that._gFlipsnap.moveToPoint(_that.dragIndexByTestIndex, 0);
                //刷新底部收藏和笔记图标
                _that.setFavTestInfos();
                _that.refreshNoteIcon();
            }
        },
        init: function(dragFlag) {
            // dragFlag: 滑动标识(0：初始化，1：上一题，2：下一题)
            let _that = this;
            let firstLoad = false; //是不是第一次绑定
            if (dragFlag !== 'card') {
                firstLoad = dragFlag ? false : true;
                dragFlag = dragFlag || 0;
            }
            let curIndex = _that._allTest.getCurIndex();
            // if (firstLoad) {
            //     curIndex = 0;
            // }
            let allTestCount = _that._allTest.getTestCount(); //当前试题总数
            let dragCount = allTestCount < 3 ? allTestCount : 3; //滑动层个数，如果试题数小于3题，则出现小于3题的滑动层
            if (firstLoad) {
                _that.moveTestTemplet(allTestCount); //在绑定之前把模板复制到目标DIV
            }
            let startIndex = 0;
            if (curIndex === 0 || dragCount < 3) {
                startIndex = 0;
            } else if (curIndex === allTestCount - 1) {
                startIndex = curIndex - 2;
            } else {
                startIndex = curIndex - 1;
            }
            // curTest使用传参的方式，解决滑动时试题会闪屏的情况
            for (let i = 0; i < dragCount; i++) {
                let curTest = _that._allTest.getTest((startIndex + i));
                _that.showCurTest(curTest, i);
                _that.setClickEvent(curTest, i); //设置页面单击事件
                _that.setTestEvent(curTest, i); //设置选项事件
                _that.controlBtn(curTest, i); //浏览试题到最后一题时，将下一题按钮变成'批阅'
                _that.hiddenTestSelects(curTest, i); //背题模式下，隐藏其它非正确的选项
                _that.changeBtn(curTest, i); //从背题模式切换到答题模式，控制查看答案、隐藏答案、答题等按钮
                _that.setPointTag(curTest, i); //拍照传题：添加知识点、标签
            }
            if (dragFlag === 'card') { //从题卡点击题卡号进入指定试题页面
                if (curIndex === 0) {
                    _that._gFlipsnap.moveToPoint(0, 0); //滑动到指定的层
                } else if (curIndex === allTestCount - 1) {
                    _that._gFlipsnap.moveToPoint(2, 0); //滑动到指定的层
                } else {
                    _that._gFlipsnap.moveToPoint(1, 0); //滑动到指定的层
                }
            }
            //刷新底部收藏和笔记图标
            _that.setFavTestInfos();
            _that.refreshNoteIcon();
            //拍照传题 隐藏页面右上角的查看解析按钮
            if (_that.title) {
                jQuery('#addFav').hide();
                jQuery('#removeFav').hide();
                jQuery('#marking2').hide();
                jQuery('#delete').show();
            } else {
                jQuery('#marking2').show();
                jQuery('#delete').hide();
            }
        },
        backUrl: function() {
            let _titname = this.$route.query.name ? this.$route.query.name : 'xxct';
            if (_titname == '') {
                _titname = 'xxct';
            }
            if (this.$route.query.name == 'znlx') {
                this.$router.push('/problemSet');
                return;
            }
            if (this.$route.query.flag) {
                this.$router.push('/problemSet');
                return;
            }
            this.$router.push('/fixedexercise?titlename=' + _titname);
        },
        favClick: function() {
            // 收藏
            this.addFav();
        },
        removefavClick: function() {
            this.removeFav();
        },
        markingPY: function() {
            let _that = this;
//          let test = _that._allTest.getCurTest();
////          if (test.testType === 'TKTEST') {
////              return;
////          }
//          let userReply = _that._allTest.getUserReply(test.testNO - 1);
////          if (!userReply) {
////              _that.G_customD.alert('请先答题，再查看解析！');
////              return;
////          }
//			if((!(test.testType =='TKTEST' || test.testType =='JDTEST') && userReply)){
//				_that._allTest.setState('commited');
//				if(_that._allTest.getIsRight(test.testNO - 1) === 1){
//          		_that._allTest.setErrorReplyCount(_that._allTest.getErrorReplyCount(test.testNO - 1) +1)
//          	}else{
//          		_that._allTest.setRightReplyCount(_that._allTest.getRightReplyCount(test.testNO - 1) +1)
//          	}
//	            let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
//	            _that.showCurTest(test, dragIndexByTestIndex);
//			}else if(test.testType =='TKTEST' || test.testType =='JDTEST'){
//				_that._allTest.setAction('lookAnswer');
////				_that._allTest.setState('commited');
//	            let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
//	            _that.showCurTest(test, dragIndexByTestIndex);
//              jQuery('.lookanswer').html('隐藏答案');
//			}
//          if (_that.$route.query.name === 'znlx') {
//              return;
//          }
            _that.markingClick();
        },
        deleteCus: function() {
            let _that = this;
            this.G_customD.confirm('确定掌握了再删掉我哦！', { yes: '确定' }, function() {
                if (window.android) {
                    if (window.android.deleteDbInfo) {
                        window.android.deleteDbInfo(_that.$route.query.photoID + '');
                        return;
                    };
                    _that.$vux.alert.show({
                        content: '暂不支持app方法！',
                        title: '温馨提示'
                    });
                    return;
                }
                _that.$vux.alert.show({
                    content: '暂不支持app方法！',
                    title: '温馨提示'
                });
            });
        },
        showCurTest: function(curTest, dragIndex) {
        	this.beginStartTime = new Date();
            // 显示试题
            let _that = this;
            if (_that._allTest.getLastAction(curTest.testNO - 1) && (curTest.testType === 'JDTEST' || curTest.testType === 'TKTEST') && _that._allTest.getAction(curTest.testNO - 1) === 'addNote') { //此判断控制简答题在查看答案后，再添加笔记时能保持之前查看答案的状态
                _that.setState(_that._allTest.getState(curTest.testNO - 1), _that._allTest.getLastAction(curTest.testNO - 1));
            } else {
                _that.setState(_that._allTest.getState(curTest.testNO - 1), _that._allTest.getAction(curTest.testNO - 1));
            }
            if (_that.title) {
                _that.$refs.chaptername.innerHTML = '线下传题';
            } else {
                let _tit = '';
                switch (_that.$route.query.name) {
                    case 'nttz':
                        _tit = '难题挑战';
                        break;
                    case 'sc':
                        _tit = '收藏试题';
                        break;
                    case 'gdlx':
                        _tit = '固定练习';
                        break;
                    case 'znlx':
                        _tit = '智能练习';
                        break;
                    default:
                        _tit = '个人习题集';
                        break;
                }
                _that.$refs.chaptername.innerHTML = _tit;
            }

            if (curTest === '' || curTest === undefined) {
                return;
            }

            let testType = curTest.testType; //根据题型调用对应的展示数据的函数
            _that.hideTestTemplet(dragIndex);
            switch (testType) {
                case 'A3TEST':
                    _that.showA3Test(curTest, dragIndex);
                    break;
                case 'ATEST':
                    _that.showATest(curTest, dragIndex);
                    break;
                case 'BTEST':
                    _that.showBTest(curTest, dragIndex);
                    break;
                case 'XTEST':
                    _that.showXTest(curTest, dragIndex);
                    break;
                case 'PDTEST':
                    _that.showPDTest(curTest, dragIndex);
                    break;
                case 'JDTEST':
                    _that.showJDTest(curTest, dragIndex);
                    break;
                case 'TKTEST':
                    _that.showTKTest(curTest, dragIndex);
                    break;
                default:
                    G_Prg.throw('程序运行错误，TestUI._showCurTest：testType = "' + testType + '"，无法解析题型');
                    break;
            }
        },
        showTopic: function(curTest, idArr, dragIndex) {
            if (this.isShowTopic) {
//              let str = '第' + curTest.testNO + '题';
                let str = curTest.testNO + '/' +this._allTest.getTestCount();
                let str2 = '模拟试题';
                //拍照传题
                if (this.title) {
                    jQuery('#' + idArr['styleExplain'] + dragIndex).hide();
                    jQuery('#' + idArr['radio_style'] + dragIndex).hide();
                    jQuery('.explain').hide();
                } else {
                    jQuery('#' + idArr['styleExplain'] + dragIndex).html(str); //题型
                    jQuery('#' + idArr['pageNumID'] + '_' + dragIndex).html(str2); //当前试题编号
                }
                if (idArr['frontTitle']) {
                    jQuery('#' + idArr['frontTitle'] + dragIndex).html(curTest.testNO + '、' + curTest.frontTitle); //标题
                    jQuery('#' + idArr['testTitle'] + dragIndex).html(curTest.title); //小标题;
                } else {
                    jQuery('#' + idArr['testTitle'] + dragIndex).html(curTest.testNO + '、' + curTest.title); //标题
                }
            } else {
                jQuery('#' + idArr['styleExplain'] + dragIndex).hide(); //题型
                jQuery('#' + idArr['curPageNum'] + dragIndex).hide(); //当前试题编号
                jQuery('#' + idArr['totalPageNum'] + dragIndex).hide(); //试题总数
                if (idArr['frontTitle']) {
                    jQuery('#' + idArr['frontTitle'] + dragIndex).hide();
                }
                jQuery('#' + idArr['testTitle'] + dragIndex).hide();
            }
        },
        showItems: function(curTest, idArr, dragIndex) {
            let selectedItems = curTest.selectedItems;
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            for (let i = 0; i < selectedItems.length; i++) {
                jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).show();
                let itemHtml = '';
                if (testType === 'XTEST' || subTestType === '不定项' || subTestType === '多项') {
                    itemHtml = '<span class="checkboxDefault">';
                } else if (testType === 'ATEST' || testType === 'PDTEST' || subTestType === '单项') {
                    itemHtml = '<span class="radioDefault">';
                }
                if (testType === 'PDTEST') { //判断题的标签lang属性存储的是“对”、“错”，其它题型存储的则是“ABCD”
                    jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).attr('lang', selectedItems[i].Content.replace(/(^\s+)|(\s+$)/g, ""));
                } else {
                    jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).attr('lang', selectedItems[i].ItemName);
                }
                jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).html(itemHtml + selectedItems[i].ItemName +
                    '</span><span class="itemContent">' + selectedItems[i].Content.replace(/(^\s+)|(\s+$)/g, "") + '</span>'); //去掉前后空格
            }
            let arrLen = jQuery('#' + idArr['itemUiID'] + dragIndex).find('li').length;
            for (let i = selectedItems.length; i < arrLen; i++) {
                jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).hide(); //隐藏没有赋值到的选项
            }
            if (this.isShowItems) {
                for (let i = 0; i < selectedItems.length; i++) {
                    jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).show();
                }
            } else {
                for (let i = 0; i < selectedItems.length; i++) {
                    jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).hide();
                }
                let arrLen = jQuery('#' + idArr['itemUiID'] + dragIndex).find('li').length;
                for (let i = selectedItems.length; i < arrLen; i++) {
                    jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).hide(); //隐藏没有赋值到的选项
                }
            }
        },
        showResult: function(curTest, idArr, dragIndex) {
        	let _that = this;
//          curTest.rightReplyCount = Number(curTest.rightReplyCount) || 0;
//          curTest.errorReplyCount = Number(curTest.errorReplyCount) || 0;
            curTest.rightReplyCount = Number(_that._allTest.getRightReplyCount(curTest.testNO-1)) || 0;
            curTest.errorReplyCount = Number(_that._allTest.getErrorReplyCount(curTest.testNO-1)) || 0;
            if (curTest.testType === 'JDTEST') {
                jQuery('#' + idArr['answerID'] + '_' + dragIndex).html('正确答案：' + curTest.answer);
                jQuery('#' + idArr['explainDiv'] + '_' + dragIndex).html('试题解析：' + curTest.explain);
                jQuery('#' + idArr['testPoint'] + '_' + dragIndex).html('考试重点：' + curTest.testPoint);
                if (this.isShowExplain) {
                    jQuery('#' + idArr['resultID'] + '_' + dragIndex).show();
                } else {
                    jQuery('#' + idArr['resultID'] + '_' + dragIndex).hide();
                }
                if (curTest.explain === '无') {
                    jQuery('#' + idArr['explainDiv'] + '_' + dragIndex).hide(); //隐藏试题解析
                } else {
                    jQuery('#' + idArr['explainDiv'] + '_' + dragIndex).show(); //隐藏试题解析
                }
                if (curTest.testPoint === '无') {
                    jQuery('#' + idArr['testPoint'] + dragIndex).hide();
                } else {
                    jQuery('#' + idArr['testPoint'] + dragIndex).show();
                }
                return;
            }
            let replyEndTime = new Date();
//          let useTime = (replyEndTime.getTime() - this.replyStartTime.getTime()) / 1000;
            let useTime = _that._allTest.getSpendTime(curTest.testNO-1);
            let deg = (90 - y_ypercent)  / curTest.ypercent * 180;
            // let circle = '<table style="float:right;width:90px;"><tr>' +
            //     '<td class="pie blueBg">' +
            //     '<div class="pieCoverC pieCoverC-r">' +
            //     '<div class="pieCover pieCover-r blueBg" style="transform: rotate(-' + deg + 'deg);">' +
            //     '</div>' +
            //     '</div>' +
            //     '<div class="pieTxt">' + curTest.ypercent + '%</div>' +
            //     '</td>' +
            //     '<td class="YSCptList_Title" style=" line-height: 20px;">' +
            //     '<span style="color:#c1c1c1;font-size:12px;">研友错误率</span>' +
            //     '</td>' +
            //     '</tr></table>';
            let circle = '<div class="jindu"><canvas id="canvas_' + dragIndex + '"></canvas>' +
                '<div class="jinduyes">研友错误率</div>' +
                '</div>';
            let y_ypercent = curTest ? curTest.ypercent ? curTest.ypercent : 0 : 0 ;
            let y_ytopReply = curTest ? curTest.ytopReply ? curTest.ytopReply : '无' : '无';
            // curTest.ypercent = curTest && curTest.ypercent ? curTest.ypercent : 0;
            // curTest.ytopReply = curTest && curTest.ytopReply === '' ? '无' : curTest.ytopReply;
            if(curTest.testType !== 'TKTEST'){
            	jQuery('#' + idArr['answerDiv'] + '_' + dragIndex).html('<span style="float:left;color:#ff4081;margin-top: 10px">我答过该题' + Number(curTest.rightReplyCount + curTest.errorReplyCount) + '次：做错' + curTest.errorReplyCount + '次<br/>本次用时：' + useTime.toFixed(2) + '″<br/>研友易错选项：' + y_ytopReply + '</span>' + circle); // + curTest.answer; //答案
            	_that.drawCircle({ id: 'canvas_' + dragIndex, angle: parseFloat(y_ypercent) / 100, lineWidth: 8, color: '#ff4081' });
            }else{
            	jQuery('#' + idArr['answerDiv'] + '_' + dragIndex).html(''); // + curTest.answer; //答案
            }
            jQuery('#' + idArr['explainDiv'] + '_' + dragIndex).html('<span class="explain-flag"></span>解析：' + curTest.explain); //解析
            jQuery('#' + idArr['testPoint'] + dragIndex).html('涉及知识点：' + curTest.testPoint); //考点
            

            if (curTest.explain === '无') {
                jQuery('#' + idArr['explainDiv'] + '_' + dragIndex).hide(); //隐藏试题解析
            } else {
                jQuery('#' + idArr['explainDiv'] + '_' + dragIndex).show(); //隐藏试题解析
            }
            if (curTest.testPoint === '无') {
                jQuery('#' + idArr['testPoint'] + dragIndex).hide();
            } else {
                jQuery('#' + idArr['testPoint'] + dragIndex).show();
            }
            if (this.isShowExplain) {
                jQuery('#' + idArr['resultID'] + '_' + dragIndex).show();
                jQuery('#' + idArr['resultFlag'] + '_' + dragIndex).show();
                if (_that.appEName === 'ZY_HS' || _that.appEName === 'ZY_LC' || _that.appEName === 'ZY_LC_ZL') {
                    jQuery('#' + 'moreBtn_' + dragIndex).css('margin-top', '70px');
                } else {
                    jQuery('#' + 'moreBtn_' + dragIndex).css('margin-bottom', '0px');
                }
            } else {
                jQuery('#' + idArr['resultID'] + '_' + dragIndex).hide();
            }
            if (this.fromUrl === 'simulatedExam.html' && this.selected === 1 && _that._allTest.getState(curTest.testNO - 1) === 'mock') {
                jQuery('#' + idArr['resultID'] + '_' + dragIndex).hide();
            }
            if (_that._allTest.getState(curTest.testNO - 1) !== 'recite') {
                jQuery('#' + idArr['answerDiv'] + '_' + dragIndex).show();
            }
            jQuery('#' + idArr['resultID'] + '_' + dragIndex).css('margin-bottom', '0px');
        },
        drawCircle: function(_options) {
            var options = _options || {};
            options.color = options.color; //定义默认颜色（包括字体和边框颜色）;
            options.lineWidth = options.lineWidth || 2; //定义默认圆描边的宽度;
            options.lineCap = options.lineCap || 'square'; //定义描边的样式，默认为直角边，round 为圆角

            var oBoxOne = document.getElementById(options.id);
            if (window.innerWidth >= 600) {
                var sCenter = jQuery(oBoxOne).width() / 2 - 14;
            } else {
                var sCenter = jQuery(oBoxOne).width() / 2 - 8;
            }
            //获取canvas元素的中心点;
            var ctx = oBoxOne.getContext('2d');
            var nBegin = Math.PI / 2; //定义起始角度;
            var nEnd = Math.PI * 2; //定义结束角度;

            // 填充文字
            var mtx = oBoxOne.getContext('2d');
            mtx.textAlign = 'center'; //定义字体居中;
            mtx.font = 'normal normal 32px Arial'; //定义字体加粗大小字体样式;
            mtx.fillStyle = options.color;
            if (options.angle == 0 || options.angle == 1) {
                mtx.fillText((options.angle * 100).toFixed(0) + '%', sCenter, sCenter + 10); //设置填充文字;
            } else {
                mtx.fillText((options.angle * 100).toFixed(0) + '%', sCenter, sCenter + 10); //设置填充文字;
            }

            jQuery('.jinduyes').css({ 'margin-left': '0px', 'margin-top': '57px' /*(sCenter - jQuery('.jinduyes').height()) + 15*/ });

            ctx.lineWidth = options.lineWidth;
            ctx.beginPath(); //设置起始路径，这段绘制360度背景;
            ctx.strokeStyle = '#dfdfdf';
            ctx.arc(sCenter, sCenter, (sCenter - options.lineWidth), -nBegin, nEnd, false);
            ctx.stroke();

            function draw(current) { //该函数实现角度绘制;
                ctx.beginPath();
                ctx.strokeStyle = options.color;
                ctx.arc(sCenter, sCenter, (sCenter - options.lineWidth), -nBegin, (nEnd * current) - nBegin, false);
                ctx.stroke();
            }
            draw(options.angle);
        },
        showUserNote: function(curTest, idArr, dragIndex) {
            let _that = this;
            let noteCountDivID = idArr['noteCountDivID'] + '_' + dragIndex;
            if (!this.isShowNote || (this.blurFlag === 'blur' && _that._allTest.getAction(curTest.testNO - 1) !== 'addNote')) {
                jQuery('#' + noteCountDivID).hide();
                return;
            }
            let myNoteID = idArr['myNoteID'] + '_' + dragIndex;
            let timeID = idArr['timeID'] + '_' + dragIndex;
            let arrAllTest = _that._allTest.getArrAllTest();
            let userNote = _that._allTest.getUserNote(curTest.testNO - 1);
            let time = _that._allTest.getTime(curTest.testNO - 1);
            if (userNote === '') {
                userNote = curTest.userNote;
                time = curTest.time;
            }
            if (userNote) {
                jQuery('#' + myNoteID).html(userNote.replace(new RegExp('\\[br\\]', 'gm'), '<br>'));
                jQuery('#' + timeID).html(time);
                jQuery('#' + noteCountDivID).show();
                return;
            }
            jQuery('#' + noteCountDivID).hide();
            jQuery('#' + myNoteID).html('');
        },
        showRadioTest: function(curTest, dragIndex) {
            let idArr = setID(curTest);
            this.showTopic(curTest, idArr, dragIndex);
            this.showItems(curTest, idArr, dragIndex);
            this.showResult(curTest, idArr, dragIndex);
            this.mockRadioDone(curTest, idArr, dragIndex);
            this.radioRightAnswer(curTest, idArr, dragIndex); //批阅：未答试题显示正确答案
            this.radioDone(curTest, idArr, dragIndex); //答题：显示用户所答是否正确
        },
        showCheckboxTest: function(curTest, dragIndex) {
            let idArr = setID(curTest);
            this.showTopic(curTest, idArr, dragIndex);
            this.showItems(curTest, idArr, dragIndex);
            this.showResult(curTest, idArr, dragIndex);
            // this.showUserNote(curTest, idArr, dragIndex); //显示用户笔记
            // this.showOtherUserNote(curTest, idArr, 0, dragIndex);
            this.mockCheckboxDone(curTest, idArr, dragIndex); //答题：用户仅选择了答案并未提交答案
            this.checkboxRightAnswer(curTest, idArr, dragIndex); //批阅：未答试题显示正确答案
            this.checkboxDone(curTest, idArr, dragIndex); //答题：显示用户所答是否正确
        },
        subjectiveTest: function(curTest, dragIndex) {
            let idArr = setID(curTest),
                _that = this;
            this.showTopic(curTest, idArr, dragIndex);
            //如果是填空题，则根据答案控制输入框的显示
            if (curTest.testType === 'TKTEST') {
                let answerArr = '';
                let answer = curTest.answer;
                // if (answer.indexOf('<img') < 0) {
                //     console.log(curTest.answer);
                //     answerArr = curTest.answer.split('；');
                // } else {
                //     answerArr = [curTest.answer];
                // }
                answerArr = [curTest.answer];
                let arrLen = jQuery('#' + idArr['itemOlID'] + dragIndex).find('li').length;
                for (let i = 0; i < arrLen; i++) {
                    if (i < answerArr.length) {
                        jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).css('display', '');
                        jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).val('');
                    } else {
                        jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).hide();
                    }
                }
                _that.mockTkDone(curTest, idArr, dragIndex);
            }
            _that.showResult(curTest, idArr, dragIndex);
            _that.showUserNote(curTest, idArr, dragIndex); //显示用户笔记
            // _that.showOtherUserNote(curTest, idArr, 0, dragIndex);
            // _that.textInputed(curTest, idArr, dragIndex); //答题：显示用户所答是否正确
        },
        setTestEvent: function(curTest, dragIndex) {
            let idArr = setID(curTest);
            let _that = this;
            let itemNameID = idArr['itemID']; //选项所在的a标签的ID
            let resultID = idArr['resultID'] + '_' + dragIndex; //显示正确答案和解题思路的div层的ID
            let buttonID = idArr['buttonID'] + '_' + dragIndex; //提交答案的按钮
            let answerID = idArr['answerID'] + '_' + dragIndex; //简答题、填空题，正确答案的div层ID
            let pageNumID = idArr['pageNumID'] + '_' + dragIndex; //显示当前试题编号和试题总数的div层ID
            let divBtnID = idArr['divBtnID'] + '_' + dragIndex; //下一题所在div层按钮ID
            let textarea = idArr['textarea'] + '_' + dragIndex;
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            let itemLen = curTest.selectedItems.length;
            if (testType === 'ATEST' || testType === 'PDTEST' || subTestType === '单项') {
                //设置radio的onclick事件
                for (let i = 0; i < itemLen; i++) {
                    jQuery('#' + itemNameID + i + '_' + dragIndex).click(function() {
                        // jQuery('#' + itemNameID + i + '_' + dragIndex).click(function() {
                        //拍照传题：禁止答题
                        if (_that.title) {
                            return;
                        }
                        //G_UserAction.addUserAction('selItem');
                        if (_that.fromUrl !== 'simulatedExam.html') {
                            _that.radioClick(curTest, jQuery(this).attr('lang'), dragIndex);
                        } else {
                            _that.radioSelected(curTest, itemNameID, jQuery(this).attr('lang'), dragIndex); //如果是从模拟考场进入做题界面，更改单选题的单击事件
                        }
                    });
                    if (!_that.isDisabled) {
                        jQuery('#' + itemNameID + i + '_' + dragIndex).click(function() {});
                    }
                }
            } else if (testType === 'XTEST' || subTestType === '不定项' || subTestType === '多项') {
                //设置复选框选择时的onclick事件
                for (let i = 0; i < itemLen; i++) {
                    jQuery('#' + itemNameID + i + '_' + dragIndex).click(function() {
                        //G_UserAction.addUserAction('selItem');
                        _that.checkboxSelected(curTest, itemNameID, jQuery(this).attr('lang'), dragIndex);
                    });
                    if (!_that.isDisabled) { //批阅后禁止答题
                        jQuery('#' + itemNameID + i + '_' + dragIndex).click(function() {});
                    }
                }
                if (_that.fromUrl !== 'simulatedExam.html') {
                    //设置checkbox中button的onclick事件
                    function _checkClick() {
                        for (let i = 0; i < itemLen; i++) {
                            let className = jQuery('#' + itemNameID + i + '_' + dragIndex).attr('class').split(' ')[0];
                            if (className === 'checkboxSelectedImg' || className === 'checkboxRightImg' || className === 'checkboxErrorImg') {
                                return true;
                            }
                        }
                        return false;
                    }
                    jQuery('#' + buttonID).click(function() {
                        //G_UserAction.addUserAction('commitBtn');
                        if (!_checkClick()) {
                            _that.G_customD.alert('请您选择答案！');
                            return;
                        }
                        _that.submitCheckboxClick(curTest, itemNameID, dragIndex);
                    });
                    if (!_that.isDisabled) { //批阅后禁止答题
                        jQuery('#' + buttonID).click(function() {});
                        jQuery('#' + buttonID).css('color', '#999'); //将按钮灰掉
                    }
                } else {
                    jQuery('#' + buttonID).hide(); //模拟考场，多选题的提交答案按钮隐藏掉
                    jQuery('#' + divBtnID).css('width', '99%');
                }
            } else if (testType === 'JDTEST') {
                if (_that._allTest.getAction(curTest.testNO - 1) === 'lookAnswer') { //隐藏按钮显示
                    jQuery('#' + buttonID).html('隐藏答案').show();
                } else { //查看按钮显示
                    jQuery('#' + buttonID).html('查看答案').show();
                }
                jQuery('#' + buttonID).unbind('click').click(function() {
                    _that.blurFlag = '';
                    jQuery('#' + textarea).blur();

                    if (jQuery('#' + buttonID).html() === '查看答案') {
                        //G_UserAction.addUserAction('lookBtn');
//                      _that.seeJDTestAnswer(curTest, textarea, 'isLook');
                        _that._allTest.setAction('lookAnswer');
                        jQuery('#' + buttonID).html('隐藏答案');
//                      _that._allTest.setUserReply(jQuery('#' + textarea).val());
                        _that._allTest.setState('commited');
//                      _that._allTest.setIsRight(1);
                    } else {
                        //G_UserAction.addUserAction('lookNoBtn');
                        jQuery('#' + buttonID).html('查看答案');
                        _that._allTest.setAction('lookNoAnswer');
                    }
                    _that.showCurTest(curTest, dragIndex);
                });
                jQuery('#' + textarea).blur(function() {
                    _that.blurFlag = 'blur';
//                  _that.seeJDTestAnswer(curTest, textarea);
                });

                // if (_that.fromUrl === 'simulatedExam.html') {
                //     jQuery('#' + buttonID).hide() //模拟考场，简答题、填空题的查看答案按钮隐藏掉
                //     jQuery('#' + divBtnID).css('width', '99%');

                // }
                if (!_that.isDisabled) { //批阅后禁止答题
                    jQuery('#' + buttonID).click(function() {});
                    jQuery('#' + textarea).blur(function() {});
                    jQuery('#' + buttonID).css('color', '#999'); //将按钮灰掉
                    jQuery('#' + textarea).attr('readonly', true);
                }
                //文本域点击阻止冒泡
                jQuery('#' + textarea).click(function(event) {
                    //阻止冒泡
                    event = event ? event : window.event;
                    event.stopPropagation();
                });

            } else if (testType === 'TKTEST') {
                if (_that._allTest.getAction(curTest.testNO - 1) === 'lookAnswer') { //隐藏按钮显示
                    jQuery('#' + buttonID).html('隐藏答案').show();
                } else { //查看按钮显示
                    jQuery('#' + buttonID).html('查看答案').show();
                }
                jQuery('#' + buttonID).unbind('click').click(function() {
                    _that.blurFlag = '';
                    let arrLen = jQuery('#' + idArr['itemOlID'] + dragIndex).find('li').length;
                    for (let i = 0; i < arrLen; i++) {
                        jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).blur();
                    }
                    if (jQuery('#' + buttonID).html() === '查看答案') {
                        //G_UserAction.addUserAction('lookBtn');
                        _that.seeTKTestAnswer(curTest, dragIndex, 'isLook');
                        _that._allTest.setAction('lookAnswer');
                        jQuery('#' + buttonID).html('隐藏答案');
                    } else {
                        //G_UserAction.addUserAction('lookNoBtn');
                        jQuery('#' + buttonID).html('查看答案');
                        _that._allTest.setAction('lookNoAnswer');
                    }
                    _that.showCurTest(curTest, dragIndex);
                });
                // let answerArr = curTest.answer.split('；');
                let answerArr = curTest.answer;
                for (let i = 0; i < answerArr.length; i++) {
                    //输入框点击阻止冒泡
                    jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).unbind('click').click(function(event) {
                        //阻止冒泡
                        event = event ? event : window.event;
                        event.stopPropagation();
                    });

                    jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).blur(function() {
                        _that.blurFlag = 'blur';
                        _that.seeTKTestAnswer(curTest, dragIndex);
                    });
                }
                if (_that.fromUrl === 'simulatedExam.html') {
                    // jQuery('#' + buttonID).hide(); //模拟考场，简答题、填空题的查看答案按钮隐藏掉
                    jQuery('#' + divBtnID).css('width', '99%');
                }
                if (!_that.isDisabled) { //批阅后禁止答题
                    jQuery('#' + buttonID).click(function() {});
                    jQuery('#' + buttonID).css('color', '#999'); //将按钮灰掉
                }
            }
            jQuery('#' + divBtnID).hide();
            jQuery('#' + divBtnID).unbind('click').click(function() {
                if (testType === 'JDTEST') {
                    jQuery('#jd_textarea_' + dragIndex).blur();
                } else if (testType === 'TKTEST') {
                    let arrLen = jQuery('#' + idArr['itemOlID'] + dragIndex).find('li').length;
                    for (let i = 0; i < arrLen; i++) {
                        jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).blur();
                    }
                }
                _that.moveNext();
            }); //Next 下一题
        },
        controlBtn: function(curTest, dragIndex) {
            let _that = this;
            let testTotal = _that._allTest.getTestCount(); //试题总数
            let userID = G_Cookie.getUserID();
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            let idArr = setID(curTest);
            let divBtnID = idArr['divBtnID'] + '_' + dragIndex;
            if (curTest.testNO === testTotal && userID && _that.checkIsBuySoft()) {
                if (testType === 'XTEST' || testType === 'TKTEST' || testType === 'JDTEST' || subTestType === '不定项' || subTestType === '多项') {
                    jQuery('#markingDiv_' + dragIndex).hide();
                    jQuery('#' + divBtnID).html('批阅');
                    jQuery('#' + divBtnID).attr('class', 'marking_button_2');
                    jQuery('#' + divBtnID).css('background-color', '#ff9900'); //样式控制 韦友爱（2014-08-14）
                    jQuery('#' + divBtnID).css('color', '#fff');
                    jQuery('#' + divBtnID).click(function() {
                        _that.markingClick();
                    }); //批阅 单击事件设置
                    //批阅后，不可再答题和批阅
                    if (!_that.isDisabled && _that._allTest.getState(curTest.testNO - 1) === 'marked') {
                        jQuery('#' + divBtnID).html('重考');
                        jQuery('#' + divBtnID).click(function() {
                            _that.reloadTest(dragIndex);
                        });
                    }
                } else {
                    jQuery('#' + divBtnID).hide();
                    jQuery('#markingDiv_' + dragIndex).show();
                    //批阅后，不可再答题和批阅
                    if (!_that.isDisabled && _that._allTest.getState(curTest.testNO - 1) === 'marked') {
                        jQuery('#markingDiv_' + dragIndex).html('重考');
                        jQuery('#markingDiv_' + dragIndex).click(function() {
                            _that.reloadTest(dragIndex);
                        });
                    }
                }
            } else {
                if (testType === 'XTEST' || testType === 'TKTEST' || testType === 'JDTEST' || subTestType === '不定项' || subTestType === '多项') {
                    jQuery('#' + divBtnID).attr('class', 'next_button_1');
                    if (G_Cookie.getNightMode()) {
                        jQuery('#' + divBtnID).css('background-color', '#4093DA'); //样式控制 韦友爱（2014-08-19）
                        jQuery('#' + divBtnID).css('color', '#fff');
                    } else {
                        jQuery('#' + divBtnID).css('background-color', '#fff'); //样式控制 韦友爱（2014-08-19）
                        jQuery('#' + divBtnID).css('color', '#000');

                    }
                    jQuery('#' + divBtnID).html('下一题');
                    jQuery('#' + divBtnID).click(function() {
                        _that.moveNext();
                    });
                }
                jQuery('#markingDiv_' + dragIndex).hide();
                jQuery('#' + divBtnID).hide();
            }
        },
        hiddenTestSelects: function(curTest, dragIndex) {
            let _that = this;
            if (_that._allTest.getState(curTest.testNO - 1) !== 'recite') {
                return;
            }
            let idArr = setID(curTest);
            let itemID = idArr['itemID'];
            let resultID = idArr['resultID'] + '_' + dragIndex; //显示正确答案和解题思路的div层的ID
            let operate = idArr['operate'] + '_' + dragIndex; //隐藏答案按钮的div层ID
            let nextBtnDiv = idArr['divBtnID'] + '_' + dragIndex; //页面中的下一题按钮的div层ID
            let buttonID = idArr['buttonID'] + '_' + dragIndex; //页面中的多选题提交答案按钮的div层ID
            let answerDiv = idArr['answerDiv'] + '_' + dragIndex; //正确答案所在的div层ID
            let explainDiv = idArr['explainDiv'] + '_' + dragIndex; //解析所在的div层ID
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            let answer = curTest.answer;
            let itemLen = curTest.selectedItems.length;
            if (testType === 'ATEST' || testType === 'PDTEST' || subTestType === '单项') {
                jQuery('#markingDiv_' + dragIndex).hide();
                jQuery('#' + nextBtnDiv).attr('class', 'next_button_1'); //修改下一题按钮样式
                if (curTest.testNO === _that._allTest.getTestCount()) {
                    jQuery('#' + nextBtnDiv).hide();
                    jQuery('#' + nextBtnDiv).html('答题');
                    jQuery('#' + nextBtnDiv).css('background-color', '#ff9900');
                    jQuery('#' + nextBtnDiv).css('color', '#FFF');
                    jQuery('#' + nextBtnDiv).click(function() {
                        _that.reciteOrDoTest('do');
                    });
                } else {
                    jQuery('#' + nextBtnDiv).css('background-color', '#FFF');
                    jQuery('#' + nextBtnDiv).css('color', '#000');
                    jQuery('#' + nextBtnDiv).html('下一题');
                    jQuery('#' + nextBtnDiv).css('width', '47%');
                }
            } else if (testType === 'XTEST' || subTestType === '不定项' || subTestType === '多项') {
                if (jQuery('#' + nextBtnDiv).html() === '批阅') {
                    jQuery('#' + nextBtnDiv).html('答题');
                    jQuery('#' + nextBtnDiv).click(function() {
                        _that.reciteOrDoTest('do');
                    });
                }
                jQuery('#' + buttonID).hide(); //隐藏提交答案按钮
                //模拟考场，控制下一题按钮长度
                if (_that.fromUrl === 'simulatedExam.html') {
                    jQuery('#' + nextBtnDiv).css('width', '47%'); //修改下一题按钮样式
                }
            } else if (testType === 'JDTEST' || testType === 'TKTEST') {
                if (testType === 'JDTEST') {
                    jQuery('#' + idArr['textarea'] + '_' + dragIndex).hide(); //隐藏文本框
                } else if (testType === 'TKTEST') {
                    let arrLen = jQuery('#' + idArr['itemOlID'] + dragIndex).find('li').length;
                    for (let i = 0; i < arrLen; i++) {
                        jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).hide();
                    }
                }
                jQuery('#' + buttonID).hide(); //隐藏查看答案按钮
                //模拟考场，控制下一题按钮长度
                if (_that.fromUrl === 'simulatedExam.html') {
                    jQuery('#' + nextBtnDiv).css('width', '47%'); //修改下一题按钮样式
                }
                if (jQuery('#' + nextBtnDiv).html() === '批阅') {
                    jQuery('#' + nextBtnDiv).html('答题');
                    jQuery('#' + nextBtnDiv).click(function() {
                        _that.reciteOrDoTest('do');
                    });
                }
            }
            jQuery('#' + operate).show(); //显示隐藏答案按钮

            if (_that._allTest.getAction(curTest.testNO - 1) === 'reciteWithAnswer') { //隐藏按钮显示
                jQuery('#' + operate).html('隐藏答案');
            } else { //查看按钮显示
                jQuery('#' + operate).html('查看答案');
            }
            jQuery('#' + operate).click(function() {
                if (jQuery('#' + operate).html() === '查看答案') {
                    //G_UserAction.addUserAction('reciteWithBtn'); 
                    _that._allTest.setAction('reciteWithAnswer');
                    jQuery('#' + operate).html('隐藏答案');
                } else {
                    _that._allTest.setAction('reciteNoAnswer');
                    jQuery('#' + operate).html('查看答案');
                }
                _that.init(0);
            });
            if (curTest.testType === 'TKTEST' || 　curTest.testType === 'JDTEST') {
                jQuery('#' + answerDiv).show(); //隐藏正确答案所在的div层
                jQuery('#' + answerDiv).attr('class', 'rightAnswer');
            } else {
                jQuery('#' + answerDiv).hide(); //隐藏正确答案所在的div层
            }
            jQuery('#' + nextBtnDiv).hide();
        },
        changeBtn: function(curTest, dragIndex) {
            let _that = this;
            if (!_that.doTest) {
                return;
            }
            let idArr = setID(curTest);
            let operate = idArr['operate'] + '_' + dragIndex; //隐藏答案按钮的div层ID
            let nextBtnDiv = idArr['divBtnID'] + '_' + dragIndex; //页面中的下一题按钮的div层ID
            let buttonID = idArr['buttonID'] + '_' + dragIndex; //页面中的多选题提交答案按钮的div层ID
            let itemID = idArr['itemID'];
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            let itemLen = curTest.selectedItems.length;
            jQuery('#' + operate).hide(); //显示隐藏答案按钮
            if (testType === 'ATEST' || testType === 'PDTEST' || subTestType === '单项') {
                jQuery('#' + nextBtnDiv).attr('class', 'next_button_3'); //修改下一题按钮样式
                jQuery('#markingDiv_' + dragIndex).html('批阅');
                jQuery('#markingDiv_' + dragIndex).click(function() {
                    _that.markingClick();
                });
                //批阅后，显示重考按钮
                if (!_that.isDisabled && _that._allTest.getState(curTest.testNO - 1) === 'marked') {
                    jQuery('#markingDiv_' + dragIndex).html('重考');
                    jQuery('#markingDiv_' + dragIndex).click(function() {
                        _reloadTest(dragIndex);
                    });
                }
                jQuery('#' + operate).click(function() {});
            } else if (testType === 'XTEST' || subTestType === '不定项' || subTestType === '多项' || testType === 'JDTEST' || testType === 'TKTEST') {
                if (testType === 'JDTEST') {
                    jQuery('#' + idArr['textarea'] + '_' + dragIndex).show();
                    jQuery('#' + idArr['answerDiv'] + '_' + dragIndex).css('color', '#666');
                }
                if (testType === 'TKTEST') {
                    jQuery('#' + idArr['answerDiv'] + '_' + dragIndex).css('color', '#666');
                }
                if (jQuery('#' + nextBtnDiv).html() === '答题') {
                    jQuery('#' + nextBtnDiv).html('批阅');
                    jQuery('#' + nextBtnDiv).click(function() {
                        _that.markingClick();
                    });
                }
                //模拟考场，控制下一题按钮长度
                if (_that.fromUrl === 'simulatedExam.html') {
                    jQuery('#' + buttonID).hide(); //隐藏按钮
                } else {
                    jQuery('#' + buttonID).show();
                    jQuery('#' + buttonID).css('color', '#000');
                }
                jQuery('#' + operate).click(function() {});
            }
            jQuery('#' + nextBtnDiv).hide();
        },
        markingClick: function() {
            let _that = this;
//          let curTest = _that._allTest.getCurTest(); //当前试题
            //点击背题模式，禁止再操作批阅
//          if (_that._allTest.getState(curTest.testNO - 1) === 'recite') { //背题模式
//              return;
//          }
            let scoresjson = _that._allTest.calculateScores(); //接收分数的json数据
            let msg = '';
            let arrAllTest = _that._allTest.getArrAllTest();
            //章节练习的多选题已被选中，但是没有进行答案的提交,在批阅后添加答题明细记录
            for (var i = 0; i < arrAllTest.length; i++) {
                if ((arrAllTest[i].isRight === 1 || arrAllTest[i].isRight === 0) && arrAllTest[i].isShowExplain === true) {
                	if(arrAllTest[i].isRight === 1){
                		_that._allTest.setErrorReplyCount(arrAllTest[i].errorReplyCount+1)
                	}else{
                		_that._allTest.setRightReplyCount(arrAllTest[i].rightReplyCount+1)
                	}
                	_that._allTest.setState('commited',1,i+1);
                	arrAllTest[i].isShowExplain = false;
                    _that.addReplyLog(_that._allTest.getTest(i), arrAllTest[i].isRight, arrAllTest[i].userReply);
                } else if(arrAllTest[i].type==='JDTEST'){
                	arrAllTest[i].action ='lookAnswer';
                	jQuery('.lookanswer').html('隐藏答案');
                }else if(arrAllTest[i].type==='TKTEST'){
                	arrAllTest[i].action ='lookAnswer';
                	jQuery('.lookanswer').html('隐藏答案');
                }
            }
            let test = _that._allTest.getCurTest();
//          if (test.testType === 'TKTEST') {
//              return;
//          }
            let userReply = _that._allTest.getUserReply(test.testNO - 1);
//          if (!userReply) {
//              _that.G_customD.alert('请先答题，再查看解析！');
//              return;
//          }
			let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
			_that.showCurTest(test, dragIndexByTestIndex);
//			if((!(test.testType =='TKTEST' || test.testType =='JDTEST') && userReply)){
//				_that._allTest.setState('commited');
//				if(_that._allTest.getIsRight(test.testNO - 1) === 1){
//          		_that._allTest.setErrorReplyCount(_that._allTest.getErrorReplyCount(test.testNO - 1) +1)
//          	}else{
//          		_that._allTest.setRightReplyCount(_that._allTest.getRightReplyCount(test.testNO - 1) +1)
//          	}
//	            
//	            
//			}else if(test.testType =='TKTEST' || test.testType =='JDTEST'){
//				_that._allTest.setAction('lookAnswer');
////				_that._allTest.setState('commited');
//	            let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
//	            _that.showCurTest(test, dragIndexByTestIndex);
//              jQuery('.lookanswer').html('隐藏答案');
//			}
//          var _onTest = _that._allTest.getOneAllTest(curTest.testNO - 1);
//          if (_onTest.isRight === 1 || _onTest.isRight === 0) {
//              _that.addReplyLog(curTest, _onTest.isRight, _onTest.userReply);
//              _that._allTest.setState('commited');
//          }
        },
        addReplyLog: function(curTest, isRight, userReply, flag) {
            let _that = this;
            var isFlag = flag || 'no';
            var replyEndTime = new Date();
            var examType = _that.setExamType();
            var infosArr = _that.checkInfos(isFlag);
            if (!infosArr) {
                return;
            }
            //添加答题明细记录
            _that._allTest.addReplyLog(curTest, infosArr['appID'], infosArr['userID'], infosArr['userName'], infosArr['guid'], userReply, isRight, replyEndTime, _that.replyStartTime, examType,_that._allTest.getSpendTime(curTest.testNO-1));
        },
        showDoneTest: function() {
            let _that = this;
            jQuery('#retake').show();
            jQuery('#marking').hide();
            jQuery('#marking2').hide();
            _that._allTest.setState('marked', 1);
            G_DialogContent.dispose();
            _that._allTest.move(0); //设置当前试题编号
            this.init(0);
            this._gFlipsnap.moveToPoint(0, 0); //滑动到指定的层
        },
        tipsBuySoft: function() {
            let _that = this;
            let msg = '请充值购买，使用更多试题！';
            G_Prg.confirm(msg, function() {
                let userID = localStorage.getItem('userID');
                if (userID) {
                    let isiphone = G_Prg.getCookie('CLIENTTYPE');
                    if (isiphone && isiphone.toString().toLowerCase() === 'iphone') {
                        window.location = "ios://iOSiap";
                    } else {
                        window.location.href = '../html/selectPrice.html?fromUrl=doExam.html&cptName=' + G_Prg.getQueryString('cptName', true);
                    }
                } else {
                    _that.$router.push('/login');
                }
            });
        },
        checkIsBuySoft: function() {
            let _that = this;
            let isVip = _that._allTest.getIsVip(); //标记是否是VIP用户
            return isVip;
        },
        checkUserTest: function() {
            let _that = this;
            if (_that.fromUrl === 'testList.html') {
                return true;
            }
            if (_that.fromUrl === 'chapterMenu.html' && G_Prg.getQueryString('type')) {
                return true;
            }
        },
        moveNext: function() {
            let _that = this;
            let testCount = _that._allTest.getTestCount(); //总试题数
            let curIndex = _that._allTest.getCurIndex(); //当前试题索引
            if (_that._allTest.moveNext()) {
                if (curIndex === 0) {
                    _that._gFlipsnap.moveToPoint(1, 0); //滑动到指定的层
                } else if (curIndex === (testCount - 2)) {
                    _that._gFlipsnap.moveToPoint(2, 0); //滑动到指定的层
                } else {
                    _that.init(2);
                    _that.reflashDragControl(1); //刷新拖拽控件
                }
                _that.setFavTestInfos();
                _that.refreshNoteIcon();
                //_showTestTypeIntro();
            } else {
                if (_that.checkIsBuySoft() || _that.checkUserTest()) {
                    _that.G_customD.alert('已经是最后一题了！');
                } else {
                    _that.tipsBuySoft();
                }
            }
        },
        movePre: function() {
            let _that = this;
            let testCount = _that._allTest.getTestCount(); //总试题数
            let curIndex = _that._allTest.getCurIndex(); //当前试题索引
            if (_that._allTest.movePre()) {
                if (curIndex === 1) {
                    _that._gFlipsnap.moveToPoint(0, 0); //滑动到指定的层
                } else if (curIndex === (testCount - 1)) {
                    _that._gFlipsnap.moveToPoint(1, 0); //滑动到指定的层
                } else {
                    _that.init(1);
                    _that.reflashDragControl(1); //刷新拖拽控件
                }
                _that.setFavTestInfos();
                _that.refreshNoteIcon();
            } else {
                _that.G_customD.alert("已经是第一题了！");
            }
        },
        reloadTest: function() {
            let _that = this;
            jQuery('#testMenu').hide();
            jQuery('#retake').hide(); //重考按钮隐藏
            jQuery('#marking').show(); //批阅按钮再次出现
            jQuery('#marking2').show(); //批阅按钮再次出现
            jQuery('#markingDiv_' + dragIndex).html('批阅');
            jQuery('#markingDiv_' + dragIndex).show();
            jQuery('#reciteImg').attr('src', '../images/beiti.png');
            jQuery('#reciteTest').find('span').css('color', '#fff');
            G_DialogContent.dispose(); //关闭弹出层
            //先清空结构体数组中用户的回答信息：隐藏正确答案与解析：恢复选项默认颜色：恢复选项的单击事件
            let arrAllTest = _that._allTest.getArrAllTest();
            for (let i = 0; i < arrAllTest.length; i++) {
                arrAllTest[i].userReply = '';
                arrAllTest[i].isRight = false;
            }
            _that._allTest.clearAction();
            _that._allTest.setState('uncommited', 1);
            _firstShow = []; //清空是否第一次显示的标记
            _addNote = [];
            _that._allTest.move(0); //跳转到第一题
            _that.init(0);
            _that._gFlipsnap.moveToPoint(0, 0); //滑动到指定的层
        },
        addFav: function() {
            let _that = this;
            let infosArr = _that.checkInfos('yes');
            if (!infosArr) {
                return;
            }
            let curTest = _that._allTest.getCurTest(); //当前试题
            _that._allTest.addFav(curTest, infosArr['appID'], infosArr['userID'], infosArr['userName'], infosArr['guid']);
            G_Prg.popMsg('已收藏');
            _that._allTest.setFav(1);
            _that.setFavTestInfos();
        },
        removeFav: function() {
            let _that = this;
            let infosArr = _that.checkInfos('yes');
            if (!infosArr) {
                return;
            }
            let curTest = _that._allTest.getCurTest(); //当前试题
            _that._allTest.removeFav(curTest, infosArr['appID'], infosArr['userID'], infosArr['userName'], infosArr['guid']);
            G_Prg.popMsg('已取消收藏');
            _that._allTest.setFav(0);
            _that.setFavTestInfos();
        },
        setFavTestInfos: function() {
            let _that = this;
            if (_that.title) {
                return;
            }
            let fav = _that._allTest.getFav(_that._allTest.getCurIndex());
            let curTest = _that._allTest.getCurTest(); //当前试题
            let curFav = 0;
            if (fav === false) {
                curFav = curTest.isFav;
            } else {
                curFav = fav;
            }
            if (curFav === 1) {
                jQuery('#removeFav').show();
                jQuery('#addFav').hide();
            } else {
                jQuery('#removeFav').hide();
                jQuery('#addFav').show();
            }
        },
        refreshNoteIcon: function() {
            let _that = this;
            let curTest = _that._allTest.getCurTest(); //当前试题
            let userNote = _that._allTest.getUserNote(_that._allTest.getCurIndex());
            if (userNote === '') {
                userNote = curTest.userNote;
            }
            if (userNote) {
                jQuery('#updateNote').show();
                jQuery('#note').hide();
            } else {
                jQuery('#updateNote').hide();
                jQuery('#note').show();
            }
        },
        setPointTag: function(curTest, dragIndex) {
            let idArr = setID(curTest),
                _that = this;
            //显示内容展示区域
            if (_that.title) {
                jQuery('#' + idArr['pointList'] + '_' + dragIndex).show();

                if (curTest.androidNote && curTest.androidNote != '') {
                    jQuery('#' + idArr['point-list'] + '_' + dragIndex).html(curTest.androidNote);
                    jQuery('#' + idArr['addPoint'] + '_' + dragIndex).html('编辑');
                }
                if (curTest.androidTag && curTest.androidTag != '') {
                    jQuery('#' + idArr['tag-list'] + '_' + dragIndex).html(curTest.androidTag);
                    jQuery('#' + idArr['addTag'] + '_' + dragIndex).html('编辑');
                }

                jQuery('#' + idArr['point-list'] + '_' + dragIndex).show();
                jQuery('#' + idArr['tag-list'] + '_' + dragIndex).show();
            }
            jQuery('#' + idArr['addPoint'] + '_' + dragIndex).unbind('click').click(function() {
                jQuery('#add_dialog').show();
                _that._gAddFlag = 'addPoint';
                if (jQuery(this).html() === '编辑') {
                    jQuery('#discuss_text').val(_that._allTest.getAndroidNote(_that._allTest.getCurTest().testNO - 1));
                }
            }); //添加知识点

            jQuery('#' + idArr['addTag'] + '_' + dragIndex).unbind('click').click(function() {
                jQuery('#add_dialog').show();
                _that._gAddFlag = 'addTag';
                if (jQuery(this).html() === '编辑') {
                    jQuery('#discuss_text').val(_that._allTest.getAndroidTag(_that._allTest.getCurTest().testNO - 1));
                }
            }); //添加标签

            jQuery('#discuss_cancel').unbind('click').click(function() {
                jQuery('#add_dialog').hide(); //隐藏输入弹窗
            });
            jQuery('#discuss_add').unbind('click').click(function() {
                let value = jQuery.trim(jQuery('#discuss_text').val());
                let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
                if (_that._gAddFlag == 'addPoint') { //添加知识点
                    _that._allTest.setAndroidNote(value);
                    jQuery('#' + idArr['point-list'] + '_' + dragIndexByTestIndex).html(value);
                    jQuery('#' + idArr['point-list'] + '_' + dragIndexByTestIndex).show();
                    jQuery('#' + idArr['addPoint'] + '_' + dragIndexByTestIndex).html('编辑');
                } else if (_that._gAddFlag == 'addTag') { //添加标签
                    _that._allTest.setAndroidTag(value);
                    jQuery('#' + idArr['tag-list'] + '_' + dragIndexByTestIndex).html(value);
                    jQuery('#' + idArr['tag-list'] + '_' + dragIndexByTestIndex).show();
                    jQuery('#' + idArr['addTag'] + '_' + dragIndexByTestIndex).html('编辑');
                }
                if (window.android) {
                    if (window.android.addDbInfo) {
                        let str = '';
                        if (_that._gAddFlag == 'addPoint') {
                            str = JSON.stringify({
                                'note': value,
                                'id': _that.$route.query.photoID + ''
                            });
                        } else if (_that._gAddFlag == 'addTag') {
                            str = JSON.stringify({
                                'tag': value,
                                'id': _that.$route.query.photoID + ''
                            });
                        }
                        window.android.addDbInfo(str);
                    }
                }
                jQuery('#discuss_text').val(''); //清空上一次输入内容
                jQuery('#add_dialog').hide(); //隐藏输入弹窗
            }); //添加

            //查看正解
            jQuery('#' + idArr['result-more'] + '_' + dragIndex).click(function() {
                let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
                jQuery('#' + idArr['testPhoto'] + '_' + dragIndexByTestIndex).attr('src', andImgSrc + '?ver=' + _that.$route.query.photoID);
                jQuery('#' + idArr['testPhoto'] + '_' + dragIndexByTestIndex).show();
            });
        },
        setExamType: function() {
            let examType = 0,
                _that = this;
            switch (_that.fromUrl) {
                case 'chapterMenu.html':
                    examType = 1; //章节练习
                    break;
                case 'simulatedExam.html':
                    examType = 2; //模拟考场
                    break;
                case 'testList.html':
                    let type = G_Prg.getQueryString('type');;
                    switch (type) {
                        case 'userError':
                            examType = 3; //错题重做
                            break;
                        case 'userFav':
                            examType = 4; //我的收藏
                            break;
                        case 'userNote':
                            examType = 5; //我的笔记
                            break;
                        case 'findTest':
                            examType = 6; //查找试题
                            break;
                    }
                    break;
            }
            return examType;
        },
        checkInfos: function(flag) {
            let userID = localStorage.getItem('userID');
            let guid = localStorage.getItem('guid');
            if (flag === 'no') {
                //判断用户是否已登陆
                if (!guid) {
                    return;
                }
            } else if (flag === 'yes') {
                //判断用户是否已登陆
                if (!guid) {
                    let _yesCallback = function() {
                        _that.$router.push('/login');
                    }
                    G_Prg.confirm('该功能请登录后使用！', _yesCallback);
                    return;
                }
            } else {
                _that.G_customD.alert('抱歉，TestUI._checkInfos: flag = "' + flag + '" 传入的参数无效！');
            }
            let appID = localStorage.getItem('AppID');
            if (!appID) {
                G_Prg.throw('程序运行错误，不能处理 testUI._checkInfos: appID=' + appID);
            }
            let userName = localStorage.getItem('username');
            let infosArr = new Object();
            infosArr['appID'] = appID;
            infosArr['userID'] = userID;
            infosArr['userName'] = userName;
            infosArr['guid'] = guid;
            return infosArr;
        },
        radioRightAnswer: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (!_that.isShowRightAnswer) {
                return;
            }
            let itemNameID = idArr['itemID']; //选项所在的a标签的ID
            let resultID = 'test_result_' + dragIndex; //显示正确答案和解题思路的div层的ID
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            let itemLen = curTest.selectedItems.length;
            for (let i = 0; i < itemLen; i++) {
                if (jQuery('#' + itemNameID + i + '_' + dragIndex).lang === curTest.answer) {
                    jQuery('#' + itemNameID + i + '_' + dragIndex).find('span')[0].attr('class', 'radioDefault');
                    jQuery('#' + itemNameID + i + '_' + dragIndex).find('span')[1].attr('class', 'itemContent rightAnswer'); //改变正确答案的字体样式
                    jQuery('#' + idArr['itemID'] + i + '_' + dragIndex).show();
                }
            }
        },
        checkboxRightAnswer: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (!_that.isShowRightAnswer) {
                return;
            }
            let itemNameID = idArr['itemID']; //选项所在的a标签的ID
            let resultID = 'test_result_' + dragIndex; //显示正确答案和解题思路的div层的ID
            let testType = curTest.testType; //试题类型
            let subTestType = curTest.subTestType; //针对A3和B题型的小题的试题类型进行定义
            let itemLen = curTest.selectedItems.length;
            let selectedItems = curTest.selectedItems;
            let answerIndex = ''; //正确答案的索引
            if (!answerIndex) {
                for (let i = 0; i < itemLen; i++) {
                    if (curTest.answer.indexOf(jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang')) >= 0) {
                        answerIndex += i + ','; //取得正确答案的checkbox的索引
                    }
                }
            }
            if (answerIndex) {
                answerIndex = answerIndex.split(',');
            }
            if (answerIndex[answerIndex.length - 1] === '') {
                answerIndex.pop();
            }
            for (let a = 0; a < answerIndex.length; a++) {
                jQuery('#' + itemNameID + answerIndex[a] + '_' + dragIndex).show();
                jQuery('#' + itemNameID + answerIndex[a] + '_' + dragIndex).attr('lang', selectedItems[answerIndex[a]].ItemName);
                jQuery('#' + itemNameID + answerIndex[a] + '_' + dragIndex).html('<span class="checkboxDefault">' + selectedItems[answerIndex[a]].ItemName +
                    '</span><span class="itemContent">' + selectedItems[answerIndex[a]].Content.replace(/(^\s+)|(\s+$)/g, "") + '</span>'); //去掉前后空格
                jQuery('#' + itemNameID + answerIndex[a] + '_' + dragIndex).find('span').eq(0).attr('class', 'checkboxDefault');
                jQuery('#' + itemNameID + answerIndex[a] + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent rightAnswer');
            }
        },
        seeTKTestAnswer: function(curTest, dragIndex, flag) {
            // body
        },
        seeJDTestAnswer: function(curTest, content) {
            // body
        },
        radioClick: function(curTest, selectedAnswer, dragIndex) {
            let _that = this;
            let isRight = 0; //标记用户的答案是否正确
            if (selectedAnswer === curTest.answer) {
                isRight = 0; //回答正确
            } else {
                isRight = 1; //回答错误
            }
            //将得到的用户数据存放入结构体当中
            if (_that._allTest.getUserReply(curTest.testNO - 1) !== selectedAnswer) { //当用户多次点击一个选项时，控制不进行答题记录的提交
                this.addReplyLog(curTest, isRight, selectedAnswer); //添加答题明细记录  
            }
            _that._allTest.setUserReply(selectedAnswer);
            _that._allTest.setState('commited');
            _that._allTest.setIsRight(isRight);
            this.showCurTest(curTest, dragIndex);
        },
        submitCheckboxClick: function(curTest, itemNameID, dragIndex) {
            let _that = this;
            _that.selected = 0;
            _that._allTest.setSelected(0); //标记章节练习的多选题已被选中，但是没有进行答案的提交；1 已选中 0 已提交
            let isRight = 0;
            let selectedAnswer = ''; //用户选择的答案
            let selectIndex = ''; //用户选择的选项索引
            let answerIndex = ''; //正确答案的索引
            let itemLen = curTest.selectedItems.length; //选项数组长度

            for (let i = 0; i < itemLen; i++) {
                let className = jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').attr('class').split(' ')[1];
                if (className === 'radioSelected' || className === 'radioRight' || className === 'radioError') {
                    selectedAnswer += jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang');
                    selectIndex += i + ','; //取得当前选中的checkbox的索引
                }
                if (curTest.answer.indexOf(jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang')) >= 0) {
                    answerIndex += i + ','; //取得正确答案的checkbox的索引
                }
            }
            let uIndex = selectIndex.split(','); //将用户选择的选项索引截取生成数组
            let aIndex = answerIndex.split(','); //将正确答案所在选项的索引截取生成数组
            //判断，如果数组的最后一个元素为空，则将其删除
            if (uIndex[uIndex.length - 1] === '') {
                uIndex.pop();
            }
            if (aIndex[aIndex.length - 1] === '') {
                aIndex.pop();
            }
            if (selectedAnswer === curTest.answer) {
                isRight = 0; //回答正确
            } else {
                isRight = 1; //回答错误
            }
            //将得到的用户数据存放入结构体
            _that.addReplyLog(curTest, isRight, selectedAnswer); //添加答题明细记录  

            _that._allTest.setUserReply(selectedAnswer);
            _that._allTest.setState('commited');
            _that._allTest.setIsRight(isRight);
            _that.showCurTest(curTest, dragIndex);
        },
        radioSelected: function(curTest, itemNameID, selectedValue, dragIndex) {
            let _that = this;
            let selectedAnswer = ''; //用户选择的答案
            let isRight = 1;
            let itemLen = curTest.selectedItems.length;
            for (let i = 0; i < itemLen; i++) {
                jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'radioDefault'); //选中之前先将其他的样式修改为默认的灰色，实现单击效果
                if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === selectedValue) {
                    let selectClassName = jQuery('#' + itemNameID + i + '_' + dragIndex).attr('class') ? 'undefined' : 'radioDefault';
                    //使用三元运算符进行判断，如果选项的样式是默认的，则使用选中样式标记改选项为已选中；如果选项的样式已经是已选中的，则修改为默认的表示已经取消选择
                    let className = (selectClassName === 'radioSelected') ? 'radioDefault' : 'radioSelected';
                    jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'radioDefault ' + className);
                }
                if (jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class').split(' ')[1] === 'radioSelected') {
                    selectedAnswer = jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang');
                }
                if (selectedAnswer === curTest.answer) {
                    isRight = 0;
                }
            }
            _that.selected = 1;
            _that._allTest.setSelected(1);
            _that._allTest.setIsRight(isRight);
            _that._allTest.setUserReply(selectedAnswer);
            _that._allTest.setState('mock');
            _that._allTest.setisShowExplain(true);
            var newDateTime = new Date().getTime();
            _that._allTest.setSpendTime((newDateTime - this.beginStartTime.getTime()) / 1000);
            _that.showCurTest(curTest, dragIndex);
        },
        checkboxSelected: function(curTest, itemNameID, selectedValue, dragIndex) {
            let _that = this;
            let selectedAnswer = ''; //用户选择的答案
            let isRight = 1;
            let itemLen = curTest.selectedItems.length;
            let optionIDAll =  jQuery('#' + itemNameID + '0_' + dragIndex).parent().find('li span:first-child'); //ABCD所在的标签
            let optionIDAll1 =  jQuery('#' + itemNameID + '0_' + dragIndex).parent().find('li span:last-child'); //ABCD所在的标签
            let idArr = setID(curTest);
            for (let i = 0; i < itemLen; i++) {
                let optionID = jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0); //ABCD所在的标签
                let optionID2 = jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(1); //选项内容所在的标签
                if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === selectedValue) {
                    let className = '';
                    if (optionID.attr('class').indexOf(' ') === -1) {
                        className = 'checkboxDefault';
                    } else {
                        className = optionID.attr('class').split(' ')[1];
                    }

                    //提交答案后，再答题，点击取消当前答案图标为默认图标
                    if (className === 'radioRight') {
                        optionID.attr('class', 'checkboxDefault');
//                      optionID2.attr('class', 'itemContent rightAnswer');
                        optionIDAll.attr('class', 'checkboxDefault');
                        optionIDAll1.attr('class', 'itemContent');
                        selectedAnswer = '';
                    } else if (className === 'radioError') {
                        optionID.attr('class', 'checkboxDefault');
//                      optionID2.attr('class', 'itemContent errorAnswer');
                        optionIDAll.attr('class', 'checkboxDefault');
                        optionIDAll1.attr('class', 'itemContent');
                        selectedAnswer = '';
                    } else {
                    	if(_that._allTest.getState(curTest.testNO -1) === 'commited'){
                    		optionIDAll.attr('class', 'checkboxDefault');
                       	    optionIDAll1.attr('class', 'itemContent');
                       	    selectedAnswer = '';
                    	}
                        //使用三元运算符进行判断，如果选项的样式是默认的，则使用选中样式标记改选项为已选中；如果选项的样式已经是已选中的，则修改为默认的表示已经取消选择
                        let className1 = (className === 'radioSelected') ? 'checkboxDefault' : 'radioSelected';
                        optionID.attr('class', 'checkboxDefault ' + className1);
                    }
                }
                let selectClassName = jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class').split(' ')[1];
                if (selectClassName === 'radioSelected' || selectClassName === 'radioRight' || selectClassName === 'radioError') {
                    selectedAnswer += jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang');
                }
            }
            if (selectedAnswer === curTest.answer) {
                isRight = 0;
            }
            if (_that.fromUrl === 'simulatedExam.html') {
                _that.selected = 1;
            } else {
                _that.selected = 1;
                _that._allTest.setSelected(1); //标记章节练习的多选题已被选中，但是没有进行答案的提交；1 已选中 0 已提交
            }
            _that._allTest.setIsRight(isRight);
            _that._allTest.setUserReply(selectedAnswer);
            if(selectedAnswer){
            	_that._allTest.setisShowExplain(true);
            }else{
            	_that._allTest.setisShowExplain(false);
            }
         	_that._allTest.setState('uncommited');
         	jQuery('#' + idArr['resultID'] + '_' + dragIndex).hide();
         	var newDateTime = new Date().getTime();
            _that._allTest.setSpendTime((newDateTime - this.beginStartTime.getTime()) / 1000);
        },
        mockCheckboxDone: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (_that.isShowUserAnswer || _that._allTest.getSelected(_that._allTest.getCurIndex()) === 1 || _that.fromUrl === 'simulatedExam.html') {
                let userReply = _that._allTest.getUserReply(curTest.testNO - 1); //获取用户的答案
                let itemLen = curTest.selectedItems.length; //选项数组长度
                let itemNameID = idArr['itemID'];
                for (let i = 0; i < itemLen; i++) {
                    for (let j = 0; j < userReply.length; j++) {
                        if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === userReply.substr(j, 1)) {
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'checkboxDefault radioSelected');
                        }
                    }
                }
            }
        },
        mockRadioDone: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (_that.isShowUserAnswer) {
                let userReply = _that._allTest.getUserReply(curTest.testNO - 1); //获取用户的答案
                let itemLen = curTest.selectedItems.length; //选项数组长度
                let itemNameID = idArr['itemID'];
                for (let i = 0; i < itemLen; i++) {
                    if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === userReply) {
                        jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'radioDefault radioSelected');
                    }
                }
            }
        },
        mockTkDone: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (_that.isShowUserAnswer) {
                let userReply = _that._allTest.getUserReply(curTest.testNO - 1); //获取用户的答案
                let userReplys = userReply.split('；'); //正确答案
                //判断，如果数组的最后一个元素为空，则将其删除
                if (userReplys[userReplys.length - 1] === '') {
                    userReplys.pop();
                }
                for (let i = 0; i < userReplys.length; i++) {
                    jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).val(userReplys[i]);
                }
            }
        },
        checkboxDone: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (!_that.isShowRightAndWrong) {
                return;
            }
            let itemNameID = idArr['itemID']; //选项所在的a标签的ID

            let userReply = _that._allTest.getUserReply(curTest.testNO - 1); //获取用户的答案
            let isRight = _that._allTest.getIsRight(curTest.testNO - 1); //获取标记用户的回答是否正确
            let selectIndex = ''; //用户选择的选项索引
            let answerIndex = ''; //正确答案的索引
            let itemLen = curTest.selectedItems.length; //选项数组长度
            let uIndex = []; //将用户选择的选项索引截取生成数组
            let aIndex = []; //将正确答案所在选项的索引截取生成数组
            //用户已经进行了做题操作
            if (userReply !== '') {
                for (let i = 0; i < itemLen; i++) {
                    if (userReply.indexOf(jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang')) >= 0) {
                        selectIndex += i + ','; //取得当前选中的checkbox的索引
                    }
                    if (curTest.answer.indexOf(jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang')) >= 0) {
                        answerIndex += i + ','; //取得正确答案的checkbox的索引
                    }
                }
                uIndex = selectIndex.split(',');
                aIndex = answerIndex.split(',');
                //判断，如果数组的最后一个元素为空，则将其删除
                if (uIndex[uIndex.length - 1] === '') {
                    uIndex.pop();
                }
                if (aIndex[aIndex.length - 1] === '') {
                    aIndex.pop();
                }
                //初始将所有正确答案的字体颜色变为绿色
                for (let a = 0; a < aIndex.length; a++) {
                    jQuery('#' + itemNameID + aIndex[a] + '_' + dragIndex).find('span').eq(0).attr('class', 'checkboxDefault');
                    jQuery('#' + itemNameID + aIndex[a] + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent rightAnswer');
                }
                for (let u = 0; u < uIndex.length; u++) {
                    if (curTest.answer.indexOf(jQuery('#' + itemNameID + uIndex[u] + '_' + dragIndex).attr('lang')) >= 0) { //用户答案中包含了正确的答案
                        jQuery('#' + itemNameID + uIndex[u] + '_' + dragIndex).find('span').eq(0).attr('class', 'checkboxDefault radioRight');
                        jQuery('#' + itemNameID + uIndex[u] + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent rightAnswer');
                    } else {
                        jQuery('#' + itemNameID + uIndex[u] + '_' + dragIndex).find('span').eq(0).attr('class', 'checkboxDefault radioError');
                        jQuery('#' + itemNameID + uIndex[u] + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent errorAnswer');
                    }
                }
            }
        },
        radioDone: function(curTest, idArr, dragIndex) {
            let _that = this;
            if (!_that.isShowRightAndWrong) { //_IsShowRightAnswer
                return;
            }
            let itemNameID = idArr['itemID'];
            let userReply = _that._allTest.getUserReply(curTest.testNO - 1); //获取用户的答案
            let isRight = _that._allTest.getIsRight(curTest.testNO - 1); //获取标记用户的回答是否正确
            let itemLen = curTest.selectedItems.length; //选项数组长度
            if (userReply !== '') {
                if (isRight === 0) { //用户回答正确
                    for (let i = 0; i < itemLen; i++) {
                        if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === userReply) {
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'radioDefault radioRight'); //指定类样式
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent rightAnswer');
                        }
                    }
                } else { //回答错误
                    for (let i = 0; i < itemLen; i++) {
                        if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === userReply) {
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'radioDefault radioError'); //显示当前被判定为错的图片
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent errorAnswer');
                        }
                        if (jQuery('#' + itemNameID + i + '_' + dragIndex).attr('lang') === curTest.answer) {
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(0).attr('class', 'radioDefault radioDefault'); //改变正确答案的字体样式
                            jQuery('#' + itemNameID + i + '_' + dragIndex).find('span').eq(1).attr('class', 'itemContent rightAnswer'); //改变正确答案的字体样式
                        }
                    }
                }
            }
        },
        setClickEvent: function(curTest, dragIndex) {
            let _that = this,
                idArr = setID(curTest);
            let styleExplain = idArr['styleExplain'] + dragIndex;
            jQuery('#' + styleExplain).click(function() {
                _that.showExplain(curTest, 1);
            });
        },
        getDragIndexByTestIndex: function() {
            let _that = this;
            // 获取当前索引
            let curTestIndex = _that._allTest.getCurIndex();
            let allTestCount = _that._allTest.getTestCount();
            let dragCount = allTestCount < 3 ? allTestCount : 3;
            if (curTestIndex === 0) {
                return 0;
            } else if (curTestIndex === allTestCount - 1) {
                return dragCount - 1;
            } else {
                return 1;
            }
        },
        hideTestTemplet: function(dragIndex) {
            jQuery('#radio_exam_' + dragIndex).hide();
            jQuery('checkbox_exam_' + dragIndex).hide();
            jQuery('pd_exam_' + dragIndex).hide();
            jQuery('jd_exam_' + dragIndex).hide();
            jQuery('tk_exam_' + dragIndex).hide();
            jQuery('A3_checkbox_exam_' + dragIndex).hide();
            jQuery('A3_radio_exam_' + dragIndex).hide();
            jQuery('B_checkbox_exam_' + dragIndex).hide();
            jQuery('B_radio_exam_' + dragIndex).hide();
            jQuery('markingDiv_' + dragIndex).hide();
        },
        showA3Test: function(curTest, dragIndex) {
            let subTestType = curTest.subTestType;
            if (subTestType === '多项' || subTestType === '不定项') {
                this.showCheckboxTest(curTest, dragIndex);
                jQuery('#A3_checkbox_exam_' + dragIndex).show();
            } else if (subTestType === '单项') {
                this.showRadioTest(curTest, dragIndex);
                jQuery('#A3_radio_exam_' + dragIndex).show();
            } else {
                G_Prg.throw('程序运行错误，TestUI._showA3Test：subTestType = "' + subTestType + '"，无法解析题型');
            }
        },
        showATest: function(curTest, dragIndex) {
            this.showRadioTest(curTest, dragIndex);
            jQuery('#radio_exam_' + dragIndex).show();
        },
        showBTest: function(curTest, dragIndex) {
            let subTestType = curTest.subTestType;
            if (subTestType === '多项' || subTestType === '不定项') {
                this.showCheckboxTest(curTest, dragIndex);
                jQuery('#A3_checkbox_exam_' + dragIndex).show();
            } else if (subTestType === '单项') {
                this.showRadioTest(curTest, dragIndex);
                jQuery('#A3_radio_exam_' + dragIndex).show();
            } else {
                G_Prg.throw('程序运行错误，TestUI._showA3Test：subTestType = "' + subTestType + '"，无法解析题型');
            }
        },
        showXTest: function(curTest, dragIndex) {
            this.showCheckboxTest(curTest, dragIndex);
            jQuery('#checkbox_exam_' + dragIndex).show();
        },
        showPDTest: function(curTest, dragIndex) {
            this.showRadioTest(curTest, dragIndex);
            jQuery('#pd_exam_' + dragIndex).show();
        },
        showJDTest: function(curTest, dragIndex) {
            this.subjectiveTest(curTest, dragIndex);
            jQuery('#jd_exam_' + dragIndex).show();
        },
        showTKTest: function(curTest, dragIndex) {
            let idArr = setID(curTest);
            let arrLen = jQuery('#' + idArr['itemOlID'] + dragIndex).find('li').length;
            for (let i = 0; i < arrLen; i++) {
                jQuery('#' + idArr['itemTextID'] + i + '_' + dragIndex).val('');
            }
            this.subjectiveTest(curTest, dragIndex);
            jQuery('#tk_exam_' + dragIndex).show();
        },
        showExplain: function(curTest, isClick) {
            let _that = this;
            for (let i = 0; i < _that.arrTypeExplain.length; i++) {
                let startNO = _that.arrTypeExplain[i].startNO;
                let endNO = _that.arrTypeExplain[i].endNO;
                if (_that.arrTypeExplain[i].type === curTest.testType) {
                    let explain = curTest.styleExplain;
                    if (!explain) {
                        break;
                    }
                    let startSubstr = explain.indexOf('(');
                    if (startSubstr !== -1) {
                        let endSubstr = explain.indexOf(')');
                        explain = '：' + explain.substr(startSubstr + 1, endSubstr - startSubstr - 1);
                    } else {
                        let startSubstr = explain.indexOf('：');
                        if (startSubstr !== -1) {
                            explain = explain.substr(startSubstr, explain.length);
                        } else {
                            explain = '';
                        }

                    }
                    if (isClick || (!isClick && startNO === curTest.testNO)) {
                        let eerorBox = jQuery('#nrdvMsgBox');
                        if (eerorBox && eerorBox.css('display') === 'block') { //判断是否有报错弹窗（被踢下线）
                            return;
                        }
                        if (startNO === endNO) {
                            // G_Prg.popMsgDialog('<B>'+curTest.testStyle+'</B>' + explain);
                            // _that.G_customD.alert('', { title: curTest.testStyle + explain, yes: '开始答题' });
                            _that.G_customD.alert('', { title: curTest.testStyle, yes: '开始答题' });
                            return;
                        }
                        _that.G_customD.alert('', { title: curTest.testStyle, yes: '开始答题' });
                        // G_Prg.popMsgDialog('<B>'+curTest.testStyle+'</B>' + explain);
                        return;
                    }
                }
            }
        },
        reciteOrDoTest: function(flag) {
            //批阅之后禁止使用背题模式
            let _that = this;
            if (flag === 'recite') {
                this.doTest = false;
                _that._allTest.setState('recite', 1);
                _that._allTest.setAction('', 1);
                jQuery('#testMenu').hide();
                jQuery('#doTest').show(); //点击背题，显示答题按钮
                jQuery('#reciteTest').hide(); //隐藏背题按钮
            } else if (flag === 'do') {
                _that._allTest.recoverState();
                doTest = true;
                jQuery('#testMenu').hide();
                jQuery('#doTest').hide(); //点击答题，显示背题按钮
                jQuery('#reciteTest').show(); //隐藏答题按钮
                jQuery('#markingImg').attr('src', '../images/piyue-xiala.png');
                jQuery('#markingImg2').attr('src', '../images/piyue-xiala.png');
                jQuery('#marking').find('span').css('color', '#fff');
                let arrAllTest = _that._allTest.getArrAllTest();
                //如果之前背题模式有点击了‘查看答案’，将其action清空
                for (let i = 0; i < arrAllTest.length; i++) {
                    _that._allTest.setAction('', 1);
                    if (_that._allTest.getState(i) === 'marked') {
                        jQuery('#marking').hide();
                        jQuery('#retake').show();
                    } else {
                        jQuery('#marking').show(); //显示批阅按钮 
                    }
                }
            }
            _that._allTest.move(_that._allTest.getCurIndex()); //跳转到指定试题
            _that.init(0);
            _that._gFlipsnap.moveToPoint(_that.getDragIndexByTestIndex(), 0); //滑动到指定的层
        },
        setState: function(state, action) {
            let _that = this;
            // 设置操作试题状态
            switch (state) {
                case 'uncommited': //未提交状态
                    _that.isShowTopic = true;
                    _that.isShowItems = true;
                    _that.isDisabled = true;
                    _that.isShowExplain = false;
                    _that.isShowRightAnswer = false;
                    _that.isShowUserAnswer = false;
                    _that.isShowNote = false;
                    _that.isShowOtherNote = false;
                    _that.isShowRightAndWrong = false;
                    break;
                case 'commited': //已提交
                    _that.isShowTopic = true;
                    _that.isShowItems = true;
                    _that.isDisabled = true;
                    _that.isShowExplain = true;
                    _that.isShowRightAnswer = true;
                    _that.isShowUserAnswer = true;
                    _that.isShowNote = true;
                    _that.isShowOtherNote = true;
                    _that.isShowRightAndWrong = true;
                    break;
                case 'recite': //背题状态
                    _that.isShowTopic = true;
                    _that.isShowItems = false;
                    _that.isDisabled = false;
                    _that.isShowExplain = false;
                    _that.isShowRightAnswer = false;
                    _that.isShowUserAnswer = false;
                    _that.isShowNote = false;
                    _that.isShowOtherNote = false;
                    _that.isShowRightAndWrong = false;
                    break;
                case 'mock': //模拟考场
                    _that.isShowTopic = true;
                    _that.isShowItems = true;
                    _that.isDisabled = true;
                    _that.isShowExplain = false;
                    _that.isShowRightAnswer = false;
                    _that.isShowUserAnswer = true;
                    _that.isShowNote = false;
                    _that.isShowOtherNote = false;
                    _that.isShowRightAndWrong = false;
                    break;
                case 'marked': //批阅状态
                    _that.isShowTopic = true;
                    _that.isShowItems = true;
                    _that.isDisabled = false;
                    _that.isShowExplain = true;
                    _that.isShowRightAnswer = true;
                    _that.isShowUserAnswer = true;
                    _that.isShowNote = true;
                    _that.isShowOtherNote = true;
                    _that.isShowRightAndWrong = true;
                    break;
            }
            switch (action) {
                case 'addNote':
                    _that.isShowNote = true;
                    _that.isShowOtherNote = true;
                    break;
                case 'reciteWithAnswer':
                    _that.isShowRightAnswer = true;
                    _that.isShowNote = true;
                    _that.isShowOtherNote = true;
                    _that.isShowExplain = true;
                    break;
                case 'reciteNoAnswer':
                    _that.isShowRightAnswer = false;
                    _that.isShowNote = false;
                    _that.isShowOtherNote = false;
                    _that.isShowExplain = false;
                    _that.isShowUserAnswer = true;
                    break;
                case 'lookAnswer':
                    _that.isShowNote = true;
                    _that.isShowOtherNote = true;
                    _that.isShowExplain = true;
                    break;
                case 'lookNoAnswer':
                    _that.isShowNote = false;
                    _that.isShowOtherNote = false;
                    _that.isShowExplain = false;
                    break;
            }
        },
        moveTestTemplet: function(allTestCount) {
            let html = '';
            if (this.htmlTemplate.length > 0) {
                html = this.htmlTemplate;
            } else {
                html = jQuery("#exambt").html();
                jQuery("#exambt").html("");
                this.htmlTemplate = html;
            }
            let htmlArr = this.replaceTempletId(html);
            //如果之前有残留，先清除
            jQuery('#innerdiv').html('');
            let testCount = allTestCount < 3 ? allTestCount : 3;
            for (let i = 1; i <= testCount; i++) {
                let testDiv = jQuery('<div></div>');
                testDiv.attr('id', 'flipTest' + i);
                jQuery('#innerdiv').append(testDiv);

                let hightDiv = jQuery('<div></div>');
                hightDiv.attr('class', 'flipDiv');

                let contentDiv = jQuery('<div></div>');
                contentDiv.attr('id', 'flipContent' + i);
                contentDiv.attr('class', 'flipContentDiv');
                contentDiv.html(htmlArr[(i - 1)]);
                jQuery('#flipTest' + i).append(contentDiv);
                jQuery('#flipTest' + i).append(hightDiv);
            }
        },
        replaceTempletId: function(htmlTemplet) {
            let indexArr = []; //id索引数组
            let currIndex = 0; //当前试题索引
            //查找所有id的索引
            while (htmlTemplet.length > currIndex && htmlTemplet.indexOf("id=", currIndex) > -1) {
                let index = htmlTemplet.indexOf("id=", currIndex);
                indexArr.push(index + 4); //加一个引号的长度
                if (index < htmlTemplet.length) {
                    currIndex = index + 1;
                } else {
                    break;
                }
                if (htmlTemplet.indexOf("id=", currIndex) <= 0) {
                    currIndex = htmlTemplet.length;
                }
            }
            let htmlArr = [];
            //生成3个滑动层的Html代码
            for (let k = 0; k < 3; k++) {
                let newHtml;
                //循环处理ID
                for (let i = indexArr.length - 1; i >= 0; i--) {
                    let end = htmlTemplet.indexOf("\"", indexArr[i]);
                    //拼接最后一个ID的HTML
                    if (i === indexArr.length - 1) {
                        newHtml = htmlTemplet.substring(indexArr[i], end) + "_" + k + htmlTemplet.substring(indexArr[i] + (end - indexArr[i]), htmlTemplet.length);
                    } else if (i === 0) { //拼接第一个ID的HTML
                        newHtml = htmlTemplet.substring(0, indexArr[i]) + htmlTemplet.substring(indexArr[i], end) + "_" + k + htmlTemplet.substring(end, indexArr[i + 1]) + newHtml;
                    } else { //拼接其他ID的HTML
                        newHtml = htmlTemplet.substring(indexArr[i], end) + "_" + k + htmlTemplet.substring(end, indexArr[i + 1]) + newHtml;
                    }
                }
                htmlArr.push(newHtml);
            }
            return htmlArr;
        },
        initFlipsnap: function(flipsnap) {
            // 滑动事件
            let _that = this;
            _that._gFlipsnap = flipsnap;
            _that._gFlipsnap = Flipsnap('#innerdiv');
            //窗体尺寸变更事件，滑动控件重新自适应大小
            window.addEventListener("resize", function() {
                /*当横竖屏切换时，宽高度自适应屏幕*/
                let fliwidth = jQuery('body').width();
                _that._gFlipsnap.distance = fliwidth;
                _that._gFlipsnap.refresh();
                _that.reflashDragControl(-1);
            }, false);
            _that._gFlipsnap.element.addEventListener('fstouchmove', function(ev) {
                if (_that.title) {
                    _that._gFlipsnap.disableTouch = false;
                    ev.preventDefault();
                }
            });
            //滑动控件完成事件，重新绑定题目和更改当前题目索引
            _that._gFlipsnap.element.addEventListener('fstouchend', function(ev) {
                _that._gFlipsnap.disableTouch = true;
                //初始滑动页面索引，用来判断是否滑动切换成功
                let startIndex = _that._gFlipsnap.currentPoint;
                setTimeout(function() {
                    let dragFlag = 0; //滑动状态标识
                    let testCount = _that._allTest.getTestCount(); //试题总数
                    //如果相等说明滑动前和滑动后索引相同，不做处理，返回
                    let dragIndexByTestIndex = _that.getDragIndexByTestIndex();
                    if (startIndex === _that._gFlipsnap.currentPoint || _that._gFlipsnap.currentPoint === dragIndexByTestIndex) {
                        _that._gFlipsnap.disableTouch = false;
                        return;
                    }

                    jQuery('#flipTest1, #flipTest2, #flipTest3').scrollTop(0);

                    //强制输入框失去焦点，防止滑动后输入焦点一直停留在输入框内
                    try {
                        jQuery('#' + 'jd_textarea_' + startIndex).blur();
                    } catch (err) {}

                    let focusId = document.activeElement.id;

                    if (focusId.indexOf('tk_itemsText_') > -1) {
                        jQuery('#' + focusId).blur();
                    }

                    let flipFlag = ''; //用户行为统计标记
                    //从第一页翻到第二页，直接索引加1
                    if (_that._gFlipsnap.currentPoint === 1 && _that._allTest.getCurIndex() === 0) {
                        _that._allTest.moveNext();
                        //下一题
                        flipFlag = 'right';
                    } else if (_that._gFlipsnap.currentPoint === 1 && _that._allTest.getCurIndex() === (testCount - 1)) { //最后一页向前翻一页，直接索引减1
                    	
                        _that._allTest.movePre();
                        flipFlag = 'left';
                    } else {
                        //如果滑动释放的时候索引不是1，则需要重新更新3个滑动页面的HTML
                        if (_that._gFlipsnap.currentPoint !== 1) {
                            //上一题
                            if (_that._gFlipsnap.currentPoint === 0) {
                                //如果是第二题，则不需要重新绑定，直接切换到滑动页面0，否则需要重新绑定题目
                                if (_that._allTest.getCurIndex() !== 1) {
                                    if (_that._allTest.movePre()) {
                                        _that.init();
                                        // _that.init(1);
                                    }
                                    _that._gFlipsnap.moveToPoint(1, 0); //滑动到指定的层
                                    dragFlag = 1;
                                } else {
                                    _that._allTest.movePre();
                                    _that.init(0);
                                    //背题模式下，隐藏其它非正确的选项
                                    // let curTest = _that._allTest.getCurTest();
                                    // if (_that._allTest.getState(curTest.testNO - 1) === 'recite') {
                                    //     _that.hiddenTestSelects(curTest, 0);
                                    // }
                                }
                                flipFlag = 'left';
                            }
                            //下一题
                            if (_that._gFlipsnap.currentPoint === 2) {
                                //如果是倒数第二题，则不需要重新绑定，直接切换到滑动页面2，否则需要重新绑定题目
                                if (_that._allTest.getCurIndex() !== testCount - 2) {
                                    if (_that._allTest.moveNext()) {
                                        // _that.init(2);
                                        _that.init();
                                    }
                                    _that._gFlipsnap.moveToPoint(1, 0); //滑动到指定的层
                                    dragFlag = 2;
                                } else {
                                    _that._allTest.moveNext();
                                    //背题模式下，隐藏其它非正确的选项
                                    let curTest = _that._allTest.getCurTest();
                                    if (_that._allTest.getState(curTest.testNO - 1) === 'recite') {
                                        _that.hiddenTestSelects(curTest, 2);
                                    }
                                }
                                flipFlag = 'right';
                            }
                        }
                    }
                    if (flipFlag === 'left') {
                        //G_UserAction.addUserAction('flipPre');
                    } else if (flipFlag === 'right') {
                        //G_UserAction.addUserAction('flipNext');
                    }

                    //刷新底部收藏和笔记图标
                    _that.setFavTestInfos();
                    _that.refreshNoteIcon();

                    //滚动到试题顶部
                    // for (let i = 1; i < 4; i++) {
                    //     if (jQuery('#' + 'flipTest' + i)) {
                    //         jQuery('#' + 'flipTest' + i).scrollTop = 0;
                    //     }
                    // }
                    _that._gFlipsnap.disableTouch = false;
                }, 350); //setTimeout end
            }, false);
            _that.reflashDragControl(-1); //刷新拖拽控件
        },
        reflashDragControl: function(index) {
            // 刷新滑动控件
            let indexTemp = index;
            this._gFlipsnap.distance = jQuery('body').width();
            if (indexTemp > -1) {
                _gFlipsnap.moveToPoint(indexTemp, 0); //滑动到指定的层
            }
            this._gFlipsnap.refresh();
        },
        showCustomBox: function() {
            let menuBox = jQuery('#customBox'),
                yBtn = jQuery('#customSure'),
                nBtn = jQuery('#customCancel'),
                xClose = jQuery('#customBtnClosed'),
                DropClose = jQuery('#customDrop');

            this.alert = function(msg, cus, callback) {
                this.show({ msg: msg, cus: cus });
            }
            this.confirm = function(msg, cus, yesCallback, noCallback) {
                cus = cus || {};
                cus.no = cus.no || '取消';
                this.show({ msg: msg, cus: cus, yesCallback: yesCallback, noCallback: noCallback });
            }
            this.show = function(obj) {
                if (!obj) {
                    return;
                }
                jQuery('#customBox').show();

                var cus = obj.cus || {};

                obj.title = cus.title || '温馨提示';
                obj.yes = cus.yes || '确定';
                obj.no = cus.no || null;
                obj.msg = obj.msg || '';

                menuBox.find('h2').html(obj.title);
                yBtn.html(obj.yes);
                nBtn.html(obj.no);

                if (obj.msg === '') {
                    menuBox.find('p').hide();
                } else {
                    menuBox.find('p').show().html(obj.msg);
                }

                if (!obj.no) {
                    yBtn.css('padding', '8px 60px');
                    nBtn.hide();
                }

                yBtn.unbind('click').click(function() {
                    try {
                        if (obj.yesCallback) {
                            obj.yesCallback();
                            close();
                        } else {
                            close();
                        }
                    } catch (err) {
                        close();
                    }
                });
                nBtn.unbind('click').click(function() {
                    try {
                        if (obj.noCallback) {
                            obj.noCallback();
                            close();
                        } else {
                            close();
                        }
                    } catch (err) {
                        close();
                    }
                });
            }

            xClose.click(function() { close() });
            DropClose.click(function() { close() });

            function close(e) {
                menuBox.hide();
                e = e || window.event;
                e.stopPropagation();
            }
        }
    },
    created: function() {
        // init
        this.onload();
    },
    mounted: function() {
        // body
        let _that = this;
        this.testUI();
    }
}

</script>
<style lang="less">
@import './doexam.less';
@import '../../style/dialog.less';
.loadWiteBG {
    position: fixed;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 10000;
    text-align: center;
    display: none;
    img {
        margin-top: 50%;
        width: 100px;
        height: 100px;
    }
    span {
        color: #9a9a9a;
        font-size: 16px;
        display: block;
        text-indent: 8px;
    }
}

</style>
